import {
    api_context_path,
    as_,
    between_,
    gt_,
    in_,
    MetaApiDelRequest,
    MetaApiFindRequest, MetaApiGetRequest,
    MetaApiSaveRequest,
    not_left_like_,
} from '../../../MetaApi'

function metaApiGetRequest(req: MetaApiGetRequest) {
    console.log(req);
}

function metaApiFindRequest(req: MetaApiFindRequest) {
    console.log(req);
}

function metaApiSaveRequest(req: MetaApiSaveRequest) {
    console.log(req);
}

function metaApiDelRequest(req: MetaApiDelRequest) {
    console.log(req);
}

metaApiFindRequest({
    "select": [
        as_("id","mid"),
        "name"
    ],
    "join": {
        "table_a ta": {
            "select": [
                "table_id aid"
            ],
            on: {
                "table_id": "mid"
            },
            "where": {
                "del": 0
            },
            "order": "id+",
            page: 1,
            size: 10
        },
        "table_b tb": {
            "select": [],
            "on": {
                "table_id": "ta.aid"
            }
        }
    }
})
metaApiFindRequest({
    // select: [as_('id', 'userid')],
    // select: as_('id', 'userid'),

    order: ["xixix"],
    join: {
        xx: {
            select: "xx",
            on: {
                'userid.id': 'xixix',
                'userid.name': 'xixix',
            },
        },
        [as_('t_tableb', 'b')]: {
            select: ["id", "name"]
        }
    }
});
metaApiGetRequest({ id: 1 })

metaApiSaveRequest({
    data: {
        username: '小明',
        user_name: '小明',
    },
})

metaApiDelRequest({
    id: ['123', as_('id', 'userid')],
    where: {
        age: 21,
        [gt_('x')]: 21,
        [between_('points')]: [1, 10],
        [not_left_like_('points')]: [1, 10],
        [in_('user_status')]: [1, 2, 3,],
    }
})
console.log(api_context_path);
console.log(gt_('xixi'))
console.log(as_('name', 'username'))